package cn.cy.behavior.observer.inter.pattern;

/**
 * @author yangxq
 * @desc
 * @date 2025-05-11
 */
public class StockDisplay implements Observer {

    private Stock stock;

    public StockDisplay(Stock stock) {
        this.stock = stock;
        stock.attach(this);
    }

    @Override
    public void update(double price) {
        System.out.println("Stock " + stock.getName() + " price updated to " + price);
    }

}
